using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;

/**
*@file       PosLogicSender.cs
*@brief      send message PosLogic
*
*@author     graywind
*@version    1.0.0.1
*@data       2012/3/16
*/

//send message PosLogic
public class msgPosLogic
{
    public const int MessageId = (int)NetMessageTypes.MessageType.PosLogic;
    //TODO
    public int SessionId = NetLib.INVALID_SESSION;
    public int WorldId = GlobalDef.INVALID_WORLD;
    public poslogic.PosLogicMain MainMsg = new poslogic.PosLogicMain();
    /// </summary>
    /// Initializes a new instance of the <see cref="msgGameLogic"/> class.
    /// </summary>
    /// <param name='session_id'>
    /// Session_id.
    /// </param>
    /// <param name='world_id'>
    /// World_id.
    /// </param>
    /// <param name='sub_id'>
    /// Sub_id.
    /// </param>
    /// <param name='buffer'>
    /// Buffer.
    /// </param>
    public msgPosLogic(int session_id, int world_id, int sub_id, byte[] buffer)
    {
        SessionId = session_id;
        WorldId = world_id;
        MainMsg.SubId = sub_id;
        MainMsg.SubBuffer = buffer;
    }
}

//handle message
public partial class gwMessagePort
{
    /// <summary>
    /// handle message
    /// </summary>
    /// <param name="msg">message wrapper of PosLogic</param>
    public static void ProcessMessage(msgPosLogic msg)
    {
        //TODO
        msgPosLogicTransfer trans = new msgPosLogicTransfer(msg.SessionId, msg.WorldId, ProtoNet<poslogic.PosLogicMain>.IntoBytes(msg.MainMsg));
        gwMessagePort.ProcessMessage(trans);
    }
}
